package com.ssg.poultry.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import org.apache.log4j.Logger;

@WebListener
public class AppStartListener implements ServletContextListener {

	private Logger logger = Logger.getLogger(this.getClass());

	public AppStartListener() {
		
	}

	public void contextDestroyed(ServletContextEvent arg0) {
		
	}

	public void contextInitialized(ServletContextEvent sce) {
		logger.debug("context init.");
		ServletContext sc = sce.getServletContext();
		String contextPath = sc.getContextPath();
		logger.debug("rootUrl:"+contextPath);
		sc.setAttribute("rootUrl", contextPath);
		sc.setAttribute("siteName", "图书借阅系统");
	}

}
